<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="button" value="参数" id="ip">
  <script src="./cs.js"></script>
  <script>
    var ins = document.getElementById("ip");
    addEven(ins,"click",function () {
      console.log(1);
    })
    addEven(ins,"click",function () {
      console.log(2);
    })
    // 参数，事件源，事件类型，事件函数
    function addEven(ele,type,fun) {
      // 检测浏览器是否有     addEventListener
      if (ele.addEventListener) {
        ele.addEventListener(type,fun)
      } else if (ele.addEvent) {
        ele.addEvent("on"+type,fun)
      }
    }

  </script>
</body>
</html>